package com.saishi.servlet;


import com.saishi.dao.QuestionDao;
import com.saishi.dao.impl.QuestionDaoImpl;
import com.saishi.entity.Question;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

@WebServlet("/quest/*")
public class QuestionServlet extends BaseServlet{
    QuestionDao qsDao = new QuestionDaoImpl();
    protected void Testda(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException {
        //查询题库总题数 用到考试面板的左边div
        List<Question> list2 = qsDao.selecttall();
        String a="1";
        a=request.getParameter("xyy");
        System.out.println(a);
        if(a==null){
            a= "1";
        }
        System.out.println(a);
        //从第一题开始放入进去
        int b=1;
        List<Question> list = qsDao.selectt20(Integer.parseInt(a),b);
        System.out.println(list2);
        System.out.println(list);
        request.getSession().setAttribute("daanlist",list);
        request.getSession().setAttribute("daandiv",list2);
        response.sendRedirect("/answer.jsp");
    }

//    //下一题
//    protected void Testdanext(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException {
//        //下一题
//        //从第一题开始放入进去
//        String a = request.getParameter("xyy");
//        int b=1;
//        List<Question> list = qsDao.selectt20(Integer.parseInt(a),b);
//        System.out.println(list);
//        request.getSession().setAttribute("daanlist",list);
//        response.sendRedirect("/answer.jsp");
//    }
}
